//============================================================================
// Copyright (C) 2003-2013 Brett R. Jones 
// All Rights Reserved
//
// You may redistribute and/or modify for non commercial and commercial uses 
// provided this copyright notice remains in place and is not modified
//
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================

#include "VxPktLib.h"

//---------------------------------------------------------------------------
const char * DescribeCmd( int iCmdType )
{
	switch( iCmdType )
	{
	case CMD_TYPE_CONNECT:			return "Connect";
	case CMD_TYPE_DISCONNECT:		return "Disconnect";
	case CMD_TYPE_OS_VER:			return "OS Version";
	case CMD_TYPE_APP_VER:			return "Application Version";
	case CMD_TYPE_EXECUTE:			return "Execute";
	case CMD_TYPE_OPEN_DOC_OR_URL:	return "Open Document or Url";
	case CMD_TYPE_FILE_SEND:		return "File Send";
	case CMD_TYPE_FILE_GET:			return "File Get";
	case CMD_TYPE_FILE_DELETE:		return "File Delete";
	case CMD_TYPE_FILE_RENAME:		return "File Rename";
	case CMD_TYPE_FILE_CHECKSUM:	return "File Checksum";
	case CMD_TYPE_LIST_DIRECTORY:	return "Make Dir List";
	default:						return "Unknown Command";
	}
}

//---------------------------------------------------------------------------
int CmdFromDescription( const char * pDesc )
{
	if( 0 == strcmp( pDesc, "Connect" ) )
	{
		return CMD_TYPE_CONNECT;
	}
	else if( 0 == strcmp( pDesc, "Disconnect" ) )
	{
		return CMD_TYPE_DISCONNECT;
	}
	else if( 0 == strcmp( pDesc, "OS Version" ) )
	{
		return CMD_TYPE_OS_VER;
	}
	else if( 0 == strcmp( pDesc, "Application Version" ) )
	{
		return CMD_TYPE_APP_VER;
	}
	else if( 0 == strcmp( pDesc, "Execute" ) )
	{
		return CMD_TYPE_EXECUTE;
	}
	else if( 0 == strcmp( pDesc, "Open Document or Url" ) )
	{
		return CMD_TYPE_OPEN_DOC_OR_URL;
	}
	else if( 0 == strcmp( pDesc, "File Send" ) )
	{
		return CMD_TYPE_FILE_SEND;
	}
	else if( 0 == strcmp( pDesc, "File Get" ) )
	{
		return CMD_TYPE_FILE_GET;
	}
	else if( 0 == strcmp( pDesc, "File Delete" ) )
	{
		return CMD_TYPE_FILE_DELETE;
	}
	else if( 0 == strcmp( pDesc, "File Rename" ) )
	{
		return CMD_TYPE_FILE_RENAME;
	}
	else if( 0 == strcmp( pDesc, "File Checksum" ) )
	{
		return CMD_TYPE_FILE_CHECKSUM;
	}
	else if( 0 == strcmp( pDesc, "Make Dir List" ) )
	{
		return CMD_TYPE_LIST_DIRECTORY;
	}
	else 
	{
		return -1;
	}
}
